package com.koron.css2.newProjectCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.newProjectCenter.bean.query.PjCheckTemplateStaffQuery;
import com.koron.css2.newProjectCenter.mapper.PjCheckTemplateStaffMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * 工程报装-工程验收员工权限单条删除
 */
public class PjCheckTemplateStaffDelete implements ServerInterface {
    @Override
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        try {
            PjCheckTemplateStaffMapper pjCheckTemplateStaffMapper = factory.getMapper(PjCheckTemplateStaffMapper.class);
            PjCheckTemplateStaffQuery pjCheckTemplateStaffQuery = JsonUtils.objectToPojo(req.getData(), PjCheckTemplateStaffQuery.class);

            // 1. 删除数据
            pjCheckTemplateStaffMapper.deleteById(pjCheckTemplateStaffQuery.getId());
            return MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "工程验收员工权限单条删除成功", null);
        } catch (Exception e) {
            logger.error("工程验收员工权限单条删除失败", e);
            return MessageBean.create(Constant.MESSAGE_INT_FAIL, "工程验收员工权限单条删除失败", null);
        }
    }
}
